package platform.testother;

public class test3 {
    public static void main(String[] args) {
        System.out.println(convertToDouble("heeeeelllllllooooo3333334"));
        System.out.println(convertToDouble("heeeeelllllllooooo333333r"));
    }

    public static double convertToDouble(String str) {
        int result = 0;
        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);
            result = result * 10 + (int) c;
        }
        return result;
    }

    public static int hash(String str) {
        final int seed = 0x9747b28c;
        final int m = 0x5bd1e995;
        final int r = 24;

        int hash = seed ^ str.length();

        int length = str.length();
        int currentIndex = 0;

        while (length >= 4) {
            int k = str.charAt(currentIndex++);
            k |= str.charAt(currentIndex++) << 8;
            k |= str.charAt(currentIndex++) << 16;
            k |= str.charAt(currentIndex++) << 24;

            k *= m;
            k ^= k >>> r;
            k *= m;

            hash *= m;
            hash ^= k;

            length -= 4;
        }

        switch (length) {
            case 3:
                hash ^= str.charAt(currentIndex + 2) << 16;
            case 2:
                hash ^= str.charAt(currentIndex + 1) << 8;
            case 1:
                hash ^= str.charAt(currentIndex);
                hash *= m;
        }

        hash ^= hash >>> 13;
        hash *= m;
        hash ^= hash >>> 15;

        return hash;
    }
}
